package other;

import java.util.Scanner;

public class YHSJ2 {
    public static void main(String[] args) {
        System.out.println("请输入您要生成的杨辉三角的高度");
        Scanner scanner = new Scanner(System.in);
        int Max = scanner.nextInt();
        int[][] nums = new int[Max][Max];
        for (int i = 0; i < nums.length; i++) {
            for (int j = 0; j < nums.length; j++) {
                if(j<=i){
                    if (j == 0 || j == nums[i].length - 1) {
                        nums[i][j] = 1;
                    }else {
                        nums[i][j] = nums[i-1][j-1] +nums[i-1][j];
                    }
                    System.out.print(nums[i][j]+" ");
                }
            }
            System.out.println();
        }

    }
}
